// 源点库相关接口
import { request } from "../base/index.mjs";
/**
 * 请求回调
 * @callback requestCallback
 * @param {object} data 请求回调的数据
 */
export default {
	//根据章节查询知识点
	queryKnowledge(opt = {}) {
		Http.callService({
			url: "cbn/knowledge/client/chapter/tree",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 根据id分页查询知识点列表
	 * @param {object} opt
	 * @param {object} opt.data 请求入参
	 * @param {string} opt.data.subjectId 科目标识
	 * @param {string} [opt.data.chapterId] 章节标识
	 * @param {number} [opt.data.knowledgeStarLevel] 知识点星级
	 * @param {string} [opt.data.knowledgeTitle] 知识点名称
	 * @param {number} [opt.data.pageIndex] 分页起始
	 * @param {number} [opt.data.pageSize] 每页条数
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryKnowledgeList(opt = {}) {
		Http.callService({
			url: "cbn/knowledge/client/list",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	queryKnowledgeListByName(params = {}) {
		return request("cbn/knowledge/client/list/by_name", params);
	},
};
